from django.db import models
from girls.models import Service
from django.core.files.base import ContentFile

STATUS_CHOICES = (
    (1, "approved")
    , (2, "deleted")
)


class Categories(models.Model):
    status_id = models.IntegerField(choices = STATUS_CHOICES)
    name = models.CharField(max_length = 256, blank = True)
    icon = models.ImageField(upload_to='categories')

    updated_at = models.DateTimeField(auto_now = True)
    created_at = models.DateTimeField(auto_now_add = True)
    def __unicode__(self):
        return self.name

class Position(models.Model):
    status_id = models.IntegerField(choices = STATUS_CHOICES)

    point_latitude = models.FloatField()
    point_longitude = models.FloatField()

    comments = models.CharField(max_length = 128, blank = True)

    categories = models.ManyToManyField(Categories, through='Assortment')
    service = models.ForeignKey(Service)

    updated_at = models.DateTimeField(auto_now = True)
    created_at = models.DateTimeField(auto_now_add = True)

class Assortment(models.Model):
    position = models.ForeignKey(Position)
    cattegory = models.ForeignKey(Categories)
    date_joined = models.DateField(auto_now_add=False)
